package com.qzy.reggie.service.impl;

import com.qzy.reggie.mapper.Two_CategoryMapper;
import com.qzy.reggie.pojo.Category;
import com.qzy.reggie.service.Two_CategoryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class Two_Two_CategoryServiceImpl implements Two_CategoryService {

    @Autowired
    private Two_CategoryMapper twoCategoryMapper;


    @Override
    public List<Category> queryCategoryList(Category category) {
        return twoCategoryMapper.selectList(category);
    }

    @Override
    public Category getCategoryById(Long id) {
        if(id == null){
            return null;
        }
        Category category = new Category();
        category.setId(id);
        return twoCategoryMapper.selectOne(category);
    }




    @Override
    public Integer save(Category category) {

        return twoCategoryMapper.insert(category);
    }



    @Override
    public Integer update(Category category) {
        return twoCategoryMapper.update(category);
    }

    @Override
    public Integer deleteCategory(Long id) {
        return twoCategoryMapper.delete(id);
    }

}
